<?php
$icon_dir = $this->Html->assetUrl('img/icons/categories/');
echo '<p>' . $this->Html->link('Thêm danh mục', array('controller' => 'categories', 'action' => 'edit'), array('class' => 'btn btn-success')) . '</p>';
?>
<div class="panel panel-primary">
	<div class="panel-heading">
	</div>
	<div class="panel-body">
		<div id="categories-list" class="thumbnails-list clearfix">
			<?php foreach ($list as $item): ?>
				<div class="col-xs-6 col-sm-4 col-md-3 thumbnail-margin">
					<div class="thumbnail">
						<?php
						echo '<label class="icon label label-' . AppConstants::$transaction_type_bootstrap_colors[$item['Category']['type']] . '">';
						if (AppConstants::TRANSACTION_TYPE_EXPENSE == $item['Category']['type']) {
							echo 'Chi';
						} else if (AppConstants::TRANSACTION_TYPE_INCOME == $item['Category']['type']) {
							echo 'Thu';
						}
						echo  '</label>';
						?>
						<img src="<?php echo $icon_dir . $item['Category']['icon_path'] ?>" alt="icon" class="category-thumbnail">
						<div class="caption">
							<p><?php echo $item['Category']['name'] ?></p>
							<div class="btn-group btn-group-justified">
								<a class="btn btn-xs btn-primary" href="#">Xem</a>
								<?php echo $this->Html->link('Sửa', array('action' => 'edit', $item['Category']['id']), array('class' => 'btn btn-xs btn-warning ')) ?>
								<?php echo $this->Form->postLink('Xóa', array('action' => 'delete', $item['Category']['id']), array('class' => 'btn btn-xs btn-danger'), 'Bạn có chắc muốn xóa không?') ?>
							</div>
						</div>
					</div>
				</div>
			<?php endforeach; ?>
		</div>
	</div>
</div>